//
//  CarFactory.m
//  设计模式
//
//  Created by huyang on 2020/7/1.
//  Copyright © 2020 test. All rights reserved.
//

#import "CarFactory.h"
#import "Car.h"
#import "JeepCar.h"
#import "SUVCar.h"
#import "BigCar.h"

@implementation CarFactory

+ (Car *)creatCarWithType:(CarType)type
{
    Car *tmpCar = nil;
    switch (type) {
        case CarType_JeepCar:
            tmpCar = [JeepCar new];
            break;
        case CarType_SUVCar:
            tmpCar = [SUVCar new];
            break;
        case CarType_BigCar:
            tmpCar = [BigCar new];
            break;
        default:
            break;
    }
    return tmpCar;
}
@end
